#! /bin/sh

#---------------------------------------------------------------------
#                           chicken and egg                           
#---------------------------------------------------------------------

test -f "${FW_ROOT}/share/fw/sh/fw-find.sh" && fws="${FW_ROOT}/share/fw/sh/fw-find.sh"
test -f "fw/sh/fw-find.sh" && fws="fw/sh/fw-find.sh"
test -f "fw.local/sh/fw-find.sh" && fws="fw.local/sh/fw-find.sh"
test ! -z "$fws" || {
  echo "revision/git/init: fatal: can't locate fw-find.sh" 1>&2
  exit 1
}

. "$fws"

#---------------------------------------------------------------------
#                              routines                               
#---------------------------------------------------------------------

fw_source "revision/git/init" "sh/fatal.sh"
fw_source "revision/git/init" "sh/parse-args.sh"
fw_source "revision/git/init" "sh/validate-args.sh"

#---------------------------------------------------------------------
#                                main                                 
#---------------------------------------------------------------------

parse_args "revision/git/init" "$@"

validate_args "revision/git/init" "name" ""

mkdir "$name" || fatal "revision/git/init"
cd "$name" || fatal "revision/git/init"
git init
